<template lang="pug">
.passwordList
  el-dialog(title="修改密码" :visible="value" @close="onClose")
    el-form(:model="form")
      el-form-item(label="旧密码" label-width="100px")
        el-input(v-model="form.oldPassword" placeholder="请输入旧密码")
      el-form-item(label="新密码" label-width="100px")
        el-input(v-model="form.newPassword" placeholder="请输入新密码")
    div(slot="footer" class="dialog-footer")
      el-button(@click="onClose") 取 消
      el-button(type="primary" @click="onSubmit") 确 定
</template>
<script>
export default {
  props:{
    value:{
      type:Boolean,
      default:false
    }
  },
  data() {
    return {
      form:{
        newPassword:"",
        oldPassword:""
      }
    }
  },
  methods: {
    onClose() {
      this.$emit('input', false)
    },
    onSubmit() {
      this.axios.post('/password/reset',{
        old_password:this.form.oldPassword,
        new_password:this.form.newPassword
      }).then(({data}) => {
        console.log(data);
      })
    }
  },
}
</script>
